<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('余额变动列表')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>快手号：</label>
                                <input type="text" id="userName" name="userName"/>
                            </li>
                            <li>
                                <label>用户ID：</label>
                                <input type="text" id="userId" name="userId"/>
                            </li>
                           <!-- <li>
                                <label>余额变动：</label>
                                <input type="text" name="balance"/>
                            </li>-->
                            <li>
                                <label>操作：</label>
                                <select name="operate" id="operate">
                                    <option value="">所有</option>
                                    <option value="1">一级佣金</option>
                                    <option value="2">二级佣金</option>
                                    <option value="3">提现</option>
                                    <option value="4">平台调整</option>
                                    <option value="5">积分兑换</option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>发生日期：</label>
                                <input style="width: 200px;" type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginDdate]" data-format="yyyy-MM-dd HH:mm:ss"/>
                                <span>-</span>
                                <input style="width: 200px;" type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endDdate]" data-format="yyyy-MM-dd HH:mm:ss"/>
                            </li>
                            <li>
                                <label style="width: 200px;">提成佣金的用户昵称：</label>
                                <input type="text" id="yongjinUserName" name="yongjinUserName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="whzj:balancerecord:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="whzj:balancerecord:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="whzj:balancerecord:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="whzj:balancerecord:export">
                    <i class="fa fa-download"></i> 导出
                </a>-->
                <div>
                    <label>余额合计：</label>
                    <input type="text" id="sumMoney" name="sumMoney"/>
                </div>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('whzj:balancerecord:edit')}]];
        var removeFlag = [[${@permission.hasPermi('whzj:balancerecord:remove')}]];
        var prefix = ctx + "whzj/balancerecord";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "余额变动",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'userId',
                    title: '用户ID'
                }, {
                    field: 'userName',
                    title: '快手号'
                },
                    {
                        field: 'front',
                        title: '变动前余额'
                    },
                {
                    field: 'balance',
                    title: '余额变动'
                },
                    {
                        field: 'after',
                        title: '变动后余额'
                    },
                {
                    field: 'operate',
                    title: '操作'
                },
                {
                    field: 'yongjinUserName',
                    title: '提成佣金的快手号'
                },
                    {
                        field: 'createTime',
                        title: '发生时间'
                    }/*,
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }*/],
                onLoadSuccess: function () {
                    //统计总额
                    $.ajax({
                        type: "post",
                        url: prefix + "/getCount?type=1&userName="+$("#userName").val()+"&operate="+$("#operate").val()+"&startTime="+$("#startTime").val()+"&endTime="+$("#endTime").val()+"&yongjinUserName="+$("#yongjinUserName").val(),
                        success: function(r) {
                            debugger;
                            $("#sumMoney").val(r.data.sumMoney);
                        }
                    });
                }
            };
            $.table.init(options);
        });
    </script>
</body>
</html>